const map = {
    number: /[^\d]/g, // 匹配整数以外的字符
    float: /[^\d\.]/g // 匹配浮点数以外的字符
}
export default {
    bind(el, binding) {
        const { arg } = binding
        el.addEventListener('keyup', () => {
            const reg = map[arg] || ''
            el.value = el.value.replace(reg, '')
            el.dispatchEvent(new Event('input'))
        })
    },
    unbind(el) {
        el.remove
    }
}